package com.example.demo.producer;

import lombok.Data;

/**
 * @Author xiao
 * @Date 2025/5/6 上午 11:10
 * @ClassName: ExtendDemo
 * @Desc:
 */
public class ExtendDemo {


    public static void main(String[] args) {
        Children children = new Children();
        children.setTem1(1000);
        children.print();
    }

    @Data
    public static class Children extends Father{
        Integer tem1 =  11;
        Integer tem2 =  22;
        Integer tem3 =  33;

        public void print(){
            System.out.println("----------就近原则----------");
            System.out.println(tem1);
            System.out.println(tem2);
            System.out.println(tem3);

            System.out.println("----------this关键字----------");
            System.out.println(this.tem1);
            System.out.println(this.tem2);
            System.out.println(this.tem3);

            System.out.println("----------super关键字----------");
            System.out.println(super.tem1);
            System.out.println(super.tem2);
            System.out.println(super.tem3);


        }
    }

    @Data
    public static class Father{
        Integer tem1 =  1;
        Integer tem2 =  2;
        Integer tem3 =  3;
    }
}
